<template>
    <div class="detail_list">
        <!--侧边导航栏 -->
        <div class="sidbar">
            <div v-for="(item,index) in Sidebarlist " :key="index" @click="switchTOgood(index)" :class="{active:btnIndex==index}">{{item}}</div>
        </div>
        <!-- 右侧列表 -->
        <div class="list" >
            <div class="title">热词</div>
            <div class="good" v-for="(item,index) in goodlist" :key="index">
                <div class="good_img">
                    <img :src="item.picture" alt="">
                </div>
                <div class="good_text">
                    <div class="name">{{item.name}}</div>
                    <div class="text">取于三文鱼中端</div>
                    <div class="theMoom">
                        <span>{{item.month_saled_content}}</span>
                        <span>好评100%</span>
                    </div>
                    <div class="price">
                        <span>￥{{item.min_price}}</span>
                        <span>+</span>
                    </div>
                </div>
            </div>
        </div>
    </div>
    
</template>

<script>
// 导入封装好的axios
import {shopinfo_list} from '../../utils/api'
export default {
    data(){
        return {
            btnIndex:0,
            // 侧边导航栏数据
            Sidebarlist:['热销','优惠','三文鱼','刺身','年货礼品区','野生大虾','冻货区','贝壳螺类','鲜虾活鱼'],
            goodlist:[]
            
        }
    },
    mounted(){
        // 请求商品收藏列表、
        shopinfo_list({id:943030044198977}).then((res)=>{
            this.goodlist=res.data.shopinfo.taglist[0].goodlist;
        })
    },
    methods: {
        switchTOgood(index){
           this.btnIndex=index;
           shopinfo_list({id:943030044198977}).then((res)=>{
                this.goodlist=res.data.shopinfo.taglist[index].goodlist;
           })
        }
    },
}
</script>

<style lang="scss" scoped>
    .detail_list{
        width: 100%;
        display: flex;
        padding: 10px;
        box-sizing: border-box;
        .sidbar{
            div{
                padding: 10px 20px;
                margin: 20px 0;
                background: #f5f5f5;
                box-sizing: border-box;
               
            }
        }
        .list{
            width: 100%;
            .good{
                display: flex;
                width: 100%;
                margin: 10px 0;
                .good_img{
                    width: 80px;
                    height: 80px;
                    margin-right: 10px;
                    img{
                        width: 100%;
                    }
                }
                .good_text{width: 100%;
                    .name{
                        
                        font-weight: bold;
                    }
                    .text{
                        font-size: 12px;
                        line-height: 20px;
                    }
                    .theMoom{
                        span{
                            font-size: 12px;
                            margin-right: 10px;
                        }
                    }
                    .price{
                        display: flex;
                        justify-content: space-between;
                        margin-top: 20px;
                        span:nth-child(1){
                            color: red;
                        }
                        span:nth-child(2){
                            width: 20px;
                            height: 20px;
                            color: white;
                            text-align: center;
                            line-height: 20px;
                            background: rgb(69, 159, 243);
                            border-radius: 50%;
                        }
                    }
                }
            }
            
        }
    }
    // 左边导航栏按钮高亮
    .active{
        color: red;
    }
</style>